package com.hmall.item.service.impl;

import com.hmall.brand.pojo.Brand;
import com.hmall.item.mapper.BrandMapper;
import com.hmall.item.service.BrandService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
@Slf4j
public class BrandImpl implements BrandService {

    @Autowired
    private BrandMapper brandMapper;
    /**
     * 分页查询
     * @param page 页码
     * @param size 每页大小
     * @return
     */
    public List<Brand> queryByPage(int page, int size) {
        int start = (page - 1) * size;
        return brandMapper.queryByPage(start, size);
    }

    @Override
    public long getTotal() {
        return brandMapper.count();
    }
}
